import sqlite3

import pandas as pd
data_path = 'data'
dfs = {}
tables = ('brand_category', 'categories', 'offer_retailer')
for table in tables:
    dfs[table] = pd.read_csv(f"{data_path}/{table}.csv")

print(dfs['brand_category'].head())

db_name = 'offer_db.sqlite'
# 将数据帧写入SQLite数据库
with sqlite3.connect(db_name) as local_db:
    for table, df in dfs.items():
        df.to_sql(table, local_db, if_exists="replace")